package com.wyh.day06.exercise;

/**
 * @author 王艺豪
 * @version 1.0
 */
public class Exercise01 {
    public static void main(String[] args) {
        Pet pet = new Pet("小黑", 4, '雄', "黑色");
        pet.name = "小黄";
        System.out.println(pet);
        pet.eat();
        pet.sleep();
    }
}

class Pet {
    String name;
    int age;
    char sex;
    String color;

    public Pet(String name, int age, char sex, String color) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.color = color;
    }

    public void eat() {
        System.out.println("正在吃...");
    }

    public void sleep() {
        System.out.println("正在睡觉...");
    }

    @Override
    public String toString() {
        return "Pet{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", color='" + color + '\'' +
                '}';
    }
}
